package com.s666.demo.controller;

import com.s666.demo.utils.Pager;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * .
 * @author lijin
 */
public abstract class BaseController {

//   这里的异常会覆盖掉 @ControllerAdvice 定义的异常
//    @Autowired
//    protected MessageRender messageRender;
//    @ExceptionHandler(value = Exception.class)
//    @ResponseBody
//    public ModelAndView commonExceptionHandler(Exception e) {
//        CommonException ce = new CommonException("500", e.getMessage());
//        return messageRender.html(ce);
//    }

    // 分页处理

    @Autowired
    private Pager pager;
    protected String getCurrentLink(HttpServletRequest request){
        return pager.getLink(request);
    }

}